aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/(profile)/follows
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-14 15:59:23 -0800
committerAdam Soltys <[email protected]>2025-01-14 15:59:23 -0800
commite7720ad5fc760a045e25f4e5fe1e089d22d90eb7 (patch)
tree143eb8427d0d50df5b6f7ea7ccdd8e70116b66df /src/routes/(app)/[username]/(profile)/follows
parent033924c7e75361ff77a7a0fdde75a8f4057a968a (diff)
downloadcoinos-ui-e7720ad5fc760a045e25f4e5fe1e089d22d90eb7.tar.gz
coinos-ui-e7720ad5fc760a045e25f4e5fe1e089d22d90eb7.zip
refactor follows
Diffstat (limited to 'src/routes/(app)/[username]/(profile)/follows')
-rw-r--r--src/routes/(app)/[username]/(profile)/follows/+page.server.js8
-rw-r--r--src/routes/(app)/[username]/(profile)/follows/+page.svelte20
2 files changed, 11 insertions, 17 deletions
diff --git a/src/routes/(app)/[username]/(profile)/follows/+page.server.js b/src/routes/(app)/[username]/(profile)/follows/+page.server.js
index 2a98b316..9fbe37a3 100644
--- a/src/routes/(app)/[username]/(profile)/follows/+page.server.js
+++ b/src/routes/(app)/[username]/(profile)/follows/+page.server.js
@@ -1,8 +1,8 @@
import { get } from "$lib/utils";
export async function load({ depends, parent }) {
- depends("app:user");
- let { subject } = await parent();
- let follows = get(`/${subject.pubkey}/follows`).catch(() => []);
- return { follows };
+ depends("app:user");
+ const { subject } = await parent();
+ const follows = get(`/${subject.pubkey}/follows`).catch(() => []);
+ return { follows };
}
diff --git a/src/routes/(app)/[username]/(profile)/follows/+page.svelte b/src/routes/(app)/[username]/(profile)/follows/+page.svelte
index ad416500..4e70686a 100644
--- a/src/routes/(app)/[username]/(profile)/follows/+page.svelte
+++ b/src/routes/(app)/[username]/(profile)/follows/+page.svelte
@@ -1,6 +1,4 @@
<script>
- import { run } from 'svelte/legacy';
-
import { onMount } from "svelte";
import { t } from "$lib/translations";
import Avatar from "$comp/Avatar.svelte";
@@ -9,11 +7,7 @@
import { invalidate } from "$app/navigation";
let { data } = $props();
- let { follows } = $state(data);
- let refresh = (data) => ({ follows } = data);
- run(() => {
- refresh(data);
- });
+ let { follows } = $derived(data);
</script>
<div class="px-3 md:px-0 w-full md:w-[400px] mx-auto">
@@ -26,9 +20,9 @@
{:then follows}
{#if follows.length}
{#if browser}
- <VirtualScroll data={follows} key="pubkey" pageMode={true}>
+ <VirtualScroll data={follows} key="pubkey" pageMode={true}>
{#snippet children({ data })}
- <a
+ <a
href={`/${data.pubkey}`}
data-sveltekit-preload-data="tap"
rel="nofollow"
@@ -45,14 +39,14 @@
<div class="w-full flex pb-1 text-black my-auto">
<div>
- <div>{data.display_name || ""}</div>
- <div class="text-secondary text-base">@{data.name}</div>
+ <div>{data.display || ""}</div>
+ <div class="text-secondary text-base">@{data.username}</div>
</div>
</div>
</div>
</a>
- {/snippet}
- </VirtualScroll>
+ {/snippet}
+ </VirtualScroll>
{/if}
{:else}
<div>No follows</div>